﻿Imports DAO
Imports DTO

Public Class KhachHangBUS
    Public Shared Function ThemKhachHang(ByVal kh As KhachHangDTO) As Boolean
        If KhachHangDAO.GetTheLoaiByMa(kh.MaKhachHang) Is Nothing Then
            KhachHangDAO.Insert(kh)
            Return True
        Else
            Return False
        End If
    End Function

    Public Shared Function XoaKhachHang(ByVal kh As KhachHangDTO) As Boolean
        If KhachHangDAO.GetTheLoaiByMa(kh.MaKhachHang) IsNot Nothing Then
            KhachHangDAO.Delete(kh)
            Return True
        Else
            Return False
        End If
    End Function

    Public Shared Function SuaKhachHang(ByVal kh As KhachHangDTO) As Boolean
        If KhachHangDAO.GetTheLoaiByMa(kh.MaKhachHang) IsNot Nothing Then
            KhachHangDAO.Update(kh)
            Return True
        Else
            Return False
        End If
    End Function
End Class
